import request from '@/utils/request'

/**
 * 获取面试技巧列表
 */

export const getArticleAPI = (params) => {
  return request({
    method: 'get',
    url: '/articles',
    params
  })
}

/**
 * 增加文章
 */
export const addArticleAPI = (data) => {
  return request({
    method: 'post',
    url: '/articles',
    data
  })
}

/**
 * 删除文章
 */
export const delArticleAPI = (id) => {
  return request({
    method: 'delete',
    url: `/articles/${id}`
  })
}

/**
 * 获取文章详情
 */
export const getArticleDetailAPI = (id) => {
  return request({
    method: 'get',
    url: `/articles/${id}`
  })
}

/**
 * 文章状态管理
 */

export const setArticleStateAPI = (id, state) => {
  return request({
    method: 'post',
    url: `/articles/${id}/${state}`
  })
}

/**
 *
 * 文章编辑
 */
export const putArticleAPI = (id, data) => {
  return request({
    method: 'put',
    url: `/articles/${id}`,
    data
  })
}

